package com.enjoyor.soa.traffic.core.efoms.mapper.impl;

import com.enjoyor.soa.traffic.core.efoms.constant.DevStatusInfoSqlId;
import com.enjoyor.soa.traffic.core.efoms.constant.DeviceWranInfoSqlId;
import com.enjoyor.soa.traffic.core.efoms.domain.DeviceStatusInfo;
import com.enjoyor.soa.traffic.core.efoms.mapper.IDeviceStatusInfoMapper;
import com.enjoyor.soa.traffic.frame.constant.BaseSqlId;
import com.enjoyor.soa.traffic.frame.support.mybatis.mapper.impl.BaseMapper;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class DeviceStatusInfoMapper extends BaseMapper<DeviceStatusInfo> implements IDeviceStatusInfoMapper {

    @Override
    public void insert (DeviceStatusInfo deviceStatusInfo){
        
        //if(devStatus!=null){
        //    sqlSessionTemplate.update(getSqlName(DevStatusInfoSqlId.SQL_UPDATE_DEV_STATUS_INFO), deviceStatusInfo);
        //}else{
        	
            sqlSessionTemplate.insert(getSqlName(BaseSqlId.SQL_INSERT), deviceStatusInfo);
        //}
    }

    @Override
    public void updateDevStatusInfo(DeviceStatusInfo deviceStatusInfo) {
        sqlSessionTemplate.update(getSqlName(DevStatusInfoSqlId.SQL_UPDATE_DEV_STATUS_INFO), deviceStatusInfo);
    }

    @Override
    public DeviceStatusInfo getDevStatusInfo(Map<String, Object> map) {
        return sqlSessionTemplate.selectOne(getSqlName(DevStatusInfoSqlId.SQL_SELECT_BY_DEV_ID), map);
    }

    @Override
    public DeviceStatusInfo getDevStatusInfoById(Map<String, Object> map) {
        return sqlSessionTemplate.selectOne(getSqlName(DevStatusInfoSqlId.SQL_SELECT_BY_DEV_ID), map);
    }
    
    @Override
    public List<DeviceStatusInfo> selectDeviceStatusList(Map<String, Object> map){
    	return sqlSessionTemplate.selectList(getSqlName(DevStatusInfoSqlId.SQL_SELECT_LIST), map);
    }
    
	@Override
    public void cleanVideoCapStatus(Map<String, Object> map) {
		sqlSessionTemplate.update(getSqlName(DevStatusInfoSqlId.SQL_CLEAN_VIDEO_CAP), map);
    }
	
	@Override
	public void refreshCheckResult(DeviceStatusInfo deviceStatusInfo) {
		// TODO Auto-generated method stub
		sqlSessionTemplate.update(getSqlName(DevStatusInfoSqlId.SQL_REFRESH_RESULT), deviceStatusInfo);
	}

}
